export default {
	state:{
		onrpx:0,
		platform:'android',
		windowWidth:0, // px
		windowHeight:0, // px
		screenWidth:0, // px
		screenHeight:0, // px
		statusBarHeight:0,// px
		videoPageHeight:0,// px
		// 底部tabbar高度(px)
		tabbarH: 50
	},
	mutations:{//必须同步执行，可以直接操作State
		mut_initLayout(state){
			let {windowWidth,windowHeight,screenWidth,screenHeight,statusBarHeight,navigationBarHeight,titleBarHeight,platform,safeArea,safeAreaInsets} = uni.getSystemInfoSync();
			console.warn('mut_initLayoutmut_initLayout');
			console.log(18,uni.getSystemInfoSync())
			state.xBarHeight = 0;
			// 苹果手机安全区高度
			if(typeof safeArea == 'object' && safeArea!=null){
				state.xBarHeight = (screenHeight-safeArea.bottom||0);
			}
			state.platform = ['android', 'ios'].includes(platform) ? platform : 'android';
			// state.platform = 'ios';
			state.windowWidth = windowWidth;
			state.titleHeight = 0;
			// #ifdef MP-TOUTIAO
			state.titleHeight = 52;
			state.videoPageHeight = screenHeight-safeAreaInsets.top-state.titleHeight-safeAreaInsets.bottom;
			// #endif
			// #ifdef MP-WEIXIN
			state.videoPageHeight = windowHeight;
			// #endif
			state.windowHeight = screenHeight-safeAreaInsets.top-state.titleHeight-safeAreaInsets.bottom - state.tabbarH;
			console.log(state.videoPageHeight);
			state.screenWidth = screenWidth;
			state.screenHeight = screenHeight-(state.xBarHeight);
			state.statusBarHeight = statusBarHeight;
			state.onrpx = screenWidth / 750;
		},
		mut_Layout(state,{k,v}){
			state[k] = v;
		},
		mut_updateList(state,res){
			if(Array.isArray(res)){
				if(res.length>0){
					state.tabList.list = res;
				}
			}
		}
	},
	actions:{//可以异步，但不能直接操作State
	}
}